<template>
  <div id="app">
    <h1>{{title}}</h1>
    <input type="text" v-model="itemVal" @keyup.enter="onEnter">
    <ul>
      <li v-for="item in items">
        <a href="javascript:;" @click="cutState(item)" :class="{ isFinish: item.isFinish }">{{item.label}}</a>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data () {
    return {
      title: 'this is to do list',
      items: [],
      itemVal: ''
    }
  },
  methods: {
    onEnter: function () {
      this.items.unshift({
        label: this.itemVal,
        isFinish: false
      })
      this.itemVal = ''
    },
    cutState: function (item) {
      item.isFinish = !item.isFinish
    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
a{
  text-decoration: none;
}
.isFinish{
  text-decoration: underline;
}
</style>
